package com.neusoft.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.neusoft.domain.Business;
import com.neusoft.service.BusinessService;
import com.neusoft.service.impl.BusinessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/BusinessController")
public class BusinessController {
    @Autowired
    BusinessService businessService;

    // 请求路径 http://ip:端口/虚拟路径/资源路径  http://ip:端口/BusinessController/getBusinessById
    // 请求参数 Integer businessId
    // 请求方式 Get
    // 响应数据 Business
    @GetMapping("/getBusinessById")
    public Business getBusinessById(Integer businessId) {
        return businessService.getBusinessById(businessId);
    }

    @GetMapping("/listBusinessByOrderTypeId")
    public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) {
        return businessService.listBusinessByOrderTypeId(orderTypeId);
    }

}
